package com.lego.service.impl;

import java.util.HashMap;
import java.util.Map;

import com.lego.bean.Administrator;
import com.lego.dao.AdminDao;
import com.lego.dao.impl.AdminDaoImpl;
import com.lego.service.AdminService;

public class AdminServiceImpl implements AdminService {
	private AdminDao adminDao=new AdminDaoImpl();
	@Override
	public Map<String, Object> adminLogin(String adminName, String adPwd) {
		Map<String,Object> map=new HashMap();
		Administrator admin=adminDao.selectAdmin(adminName, adPwd);
		if(admin != null){
			map.put("admin", admin);
		}else {
			admin=adminDao.selectAdminByName(adminName);
			if(admin == null) {
				map.put("msg","用户名不存在");
			}else {
				map.put("msg","密码错误");
			}
			
		}
		
		return map;
	}



}
